package com.ivo.model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.ivo.model.Model;

@Entity
@Table (name = "PDM_O_ROLE")
public class Role extends Model {

	private static final long serialVersionUID = 6564804923082347826L;
	
	private String roleId;
	private String roleName;
	
	List<UserRole> userRoles;
	
	public Role(){}

	@Id
	@Column(name = "ROLE_ID")
	public String getRoleId() {
		return roleId;
	}

	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}
	
	@Column(name = "ROLE_NAME")
	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	
	@OneToMany(cascade = {CascadeType.MERGE}, targetEntity = UserRole.class, mappedBy = "role", fetch=FetchType.LAZY)
	public List<UserRole> getUserRoles() {
		return userRoles;
	}
	
	public void setUserRoles(List<UserRole> userRoles) {
		this.userRoles = userRoles;
	}

}
